package cn.piesat.scanning.business.dq1043.config;

import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

/**
 * @author xhl
 * @Date 2020/9/10
 */
@Configuration
public class BeanConfig {

    @Value("${spring.kafka.consumer.metadata.group}")
    private String metaDataConsumerGroup;

    @Value("${spring.kafka.consumer.metadata.topic}")
    private String metaDataConsumerTopic;

    @Bean
    public KafkaConsumer kafkaConsumer() {
        KafkaConsumer consumer = KafkaConsumerFactory.getKafkaConsumer(metaDataConsumerGroup);
        consumer.subscribe(Arrays.asList(metaDataConsumerTopic));
        return consumer;
    }

}
